package com.bdqn.t330.controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class HelloController extends AbstractController {


    //ModelAndView模型和视图
    //模型:页面要渲染的数据
    //视图:需要返回到那个页面

    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
        System.out.println("hello..........");
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("/hello");
        modelAndView.addObject("age",18);
        //return  new ModelAndView("hello");
        return modelAndView;
    }
}
